export function getArg (key) {
    var l = window.location.hash;
    if(l.indexOf('?') == -1)return '';
    l = l.split('?')[1];
    let ary = l.split("&");
    for(var i = 0 ; i < ary.length ; i++){
        if(ary[i].split("=")[0]==key){
            return ary[i].split("=")[1];
        }
    }
    return '';
}
export function getBaicPostData(postdata={}){
    return {
        authParam:{
            tenantId: getArg('tenantId'),
            userId : getArg('userId')
        },
        param:{
            ...postdata,
            carClassesCode:'carClassesCode' in postdata?postdata.carClassesCode:getArg('carClassesCode')
        },
        reqMethod:{
            isJsonP:1
        }
    }
}
export function createForm(reqURL,param,iframeName){
    var formDom=$("<form>");//定义一个form表单  
    formDom.attr("style","display:none");  
    formDom.attr("target",iframeName);  
    formDom.attr("method","post");  
    formDom.attr("action",reqURL);  
    for(let k in param){
        var input1=$("<input>");  
        input1.attr("type","hidden");  
        input1.attr("name",k);  
        input1.attr("value",param[k]);  
    }
    $("body").append(formDom);//将表单放置在web中  
    formDom.append(input1);  
    formDom.submit();//表单提交 
    formDom.remove();
}